package com.cloud.DrugManagement.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.cloud.DrugManagement.enums.OrderState;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author zhozixiong
 * @date 2023/02/11
 */
@TableName
@ApiModel(description = "订单基础信息")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderDetails {
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty("订单编号")
    private Long oid;
    @ApiModelProperty("供应商编号")
    private Integer sid;
    @ApiModelProperty("供应商名称")
    private String sname;
    @ApiModelProperty("提交时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date creationTime;
    @ApiModelProperty("订单状态")
    @EnumValue
    private OrderState state;

    public OrderDetails(OrderDetails orderDetails) {
        if(orderDetails != null) {
            this.oid = orderDetails.getOid();
            this.sid = orderDetails.getSid();
            this.sname = orderDetails.getSname();
            this.creationTime = orderDetails.getCreationTime();
            this.state = orderDetails.getState();
        }
    }
}
